<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>注册页面</title>
    <link rel="stylesheet" href="/css/reset.css" />
    <link rel="stylesheet" href="/css/common.css" />
    <link rel="stylesheet" href="/css/font-awesome.min.css" />
</head>
<body>
<div class="wrap login_wrap">
    <div class="content">
        <div class="logo"></div>
        <div class="login_box">
            <div class="login_form">
                <div class="login_title">注册</div>
                <form action="/main/register" method="post" onsubmit="return checkPassword()">
                    <div class="form_text_ipt">
                        <input name="username" type="text" placeholder="用户名" />
                    </div>
                    <div class="ececk_warning"><span>用户名</span></div>
                    <div class="form_text_ipt">
                        <input name="password" type="password" placeholder="密码"  minlength="6"/>
                    </div>
                    <div class="ececk_warning"><span>密码不能为空</span></div>
                    <div class="form_text_ipt">
                        <input
                                name="repassword"
                                type="password"
                                placeholder="重复密码"
                                minlength="6"
                        />
                    </div>
                    <div class="ececk_warning"><span>密码不能为空</span></div>
                    <div class="ececk_warning"><span>两次密码不同</span></div>
                    <div class="form_btn">
                        <button type="submit">
                            注册
                        </button>
                    </div>
                    <div class="form_reg_btn">
                        <span>已有帐号？</span><a href="/page/login">马上登录</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="/js/jquery.min.js"></script>
<script>
    function checkPassword() {
        var password = document.getElementsByName("password")[0].value;
        var repassword = document.getElementsByName("repassword")[0].value;
        if (password === repassword) {
            // 密码匹配，可以继续提交表单
            return true;
        } else {
            // 密码不匹配，显示错误信息
            var warning = document.getElementsByClassName("ececk_warning")[3];
            warning.style.display = "block";
            return false;
        }
    }
</script>
<div style="text-align: center"></div>
</body>
</html>
